<template>
  <div class="sub-menu">
    <template v-for="(item, index) in menus">
      <el-submenu
        :index="item.meta.fullPath"
        v-if="item.children && item.children.length > 0"
      >
        <template slot="title">
          <i :class="item.meta.icon"></i>
          <span slot="title">{{ item.meta.name }}</span>
        </template>

        <el-menu-item-group>
          <sub-menu :menus="item.children"></sub-menu>
        </el-menu-item-group>
      </el-submenu>

      <el-menu-item v-else :index="item.meta.fullPath">
        <i :class="item.meta.icon"></i>
        <span slot="title">{{ item.meta.name }}</span>
      </el-menu-item>
    </template>
  </div>
</template>

<script>
export default {
  name: "sub-menu",
  props: {
    menus: {
      type: Array,
      default: () => [],
    },
  },
};
</script>

<style scoped>

</style>
